<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
        <head>
                <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
                <title></title>
                <link rel="stylesheet" href="__PUBLIC__/Css/bootstrap.min.css" />
                <link rel="stylesheet" href="__PUBLIC__/Css/common.css" />
                <jquery/>
                <script type="text/javascript">
                        $(function() {
                                $('select[name=type_tid]').change(function() {
                                        $(this).find('option[value=0]').attr('disabled','disabled');
                                        var oVal = $(this).val();
                                        $.ajax({
                                                url: '__MODULE__' + '&m=Admin&c=Category&a=ajax_cate',
                                                data: {tid: oVal},
                                                dataType: 'json',
                                                type: 'post',
                                                success: function(data) {
                                                        var option='<option value="0">顶级分类</option>';
                                                        if(data){
                                                              $.each(data,function(k,v){
                                                                option+='<option value='+v.cid+'>'+v._name+'</option>';
                                                                })  
                                                        }
                                                        $('select[name=pid]').html('');
                                                        $('select[name=pid]').append(option);
                                                }
                                        })
                                })
                        })
                </script>
        </head>
        <body>
                <form action="" method='post'>
                        <div class="container-fluid">
                                <div class="row-fluid">
                                        <div class="span12"> 
                                                <fieldset>
                                                        <legend>添加商品分类</legend> 
                                                        <table class="table table-bordered table-hover">

                                                                <tr class="info">
                                                                        <td>所属类型</td>
                                                                        <td>
                                                                                <select name="type_tid" >
                                                                                        <option value="0">----------请选择----------</option>
                                                                                        <foreach from='$data' value='$v'>
                                                                                                <option value="{$v.tid}">{$v.tname}</option>
                                                                                        </foreach>
                                                                                </select>
                                                                        </td>
                                                                </tr>
                                                                <tr class="info">
                                                                        <td>所属分类</td>
                                                                        <td>
                                                                                <select name="pid" >
                                                                                        <option value="0">顶级分类</option>
                                                                                </select>
                                                                        </td>
                                                                </tr>
                                                                <tr class="info">
                                                                        <td>分类名称</td>
                                                                        <td>
                                                                                <input type="text" name='cname'/>
                                                                        </td>
                                                                </tr>
                                                                <tr class="info">
                                                                        <td>排序</td>
                                                                        <td>
                                                                                <input type="text" name='sort' value='100'/>
                                                                        </td>
                                                                </tr>
                                                                <tr>
                                                                        <td colspan="2" align="center">
                                                                                <input type="submit" value="添加分类" class="btn btn-primary" />
                                                                        </td>
                                                                </tr>
                                                        </table>
                                                </fieldset>
                                        </div>
                                </div>
                        </div>
                </form>
        </body>
</html>